import request from '@/axios'

export default {
    /**
     * 动态分类表单
     * @param {*} id 
     */
    dynamicCategoryForm(id){
        return request.request({
            url: 'dynamic/form/attach/category/create/'+id,
            method: 'get'
        })
    },
      /**
     * 动态分类表单
     * @param {*} id 
     */
      dynamicCategoryEditForm(id){
        return request.request({
            url: 'dynamic/form/attach/category/edit/'+id,
            method: 'get'
        })
    },
    /**
     * 附件分类--列表
     * @returns
     */
    getCategoryList(params = {}) {
        return request.request({
            url: 'attach/category',
            method: 'get',
            data: params
        })
    },
    /**
     * 附件分类--列表
     * @returns
     */
    getCategoryTree(params = {}) {
        return request.request({
            url: 'attach/category/tree',
            method: 'get',
            data: params
        })
    },
    /**
     * 添加分类
     * @param {*} params 
     * @returns 
     */
    saveCategory(data = {}) {
        return request.request({
            url: 'attach/category/save',
            method: 'post',
            data
        })
    },
    /**
     * 更新分类
     * @param {*} id 
     * @param {*} data 
     * @returns 
     */
    updateCategory(id, data = {}) {
        return request.request({
            url: 'attach/category/update/' + id,
            method: 'put',
            data
        })
    },
    /**
     * 删除分类
     * @param {*} data 
     * @returns 
     */
    deleteCategory(data) {
        return request.request({
            url: 'attach/category/delete',
            method: 'delete',
            data
        })
    },
    /**
     * 图片上传
     * @param {*} data 
     * @returns 
     */
    uploadImage(data = {}) {
        return request.request({
            url: 'system/attach/uploadImage',
            method: 'post',
            timeout: 30000,
            headers: { 'Content-Type': 'multipart/form-data' },
            data
        })
    },
    /**
   * 上传文件接口
   * @returns
   */
    uploadFile(data = {}) {
        return request.request({
            url: 'system/attach/uploadFile',
            method: 'post',
            timeout: 30000,
            // headers: { 'Content-Type': 'multipart/form-data' },
            data
        })
    },
    /**
   * 分片上传接口
   * @returns
   */
    chunkUpload(data = {}) {
        return request.request({
            url: 'system/attach/chunkUpload',
            method: 'post',
            timeout: 30000,
            // headers: { 'Content-Type': 'multipart/form-data' },
            data
        })
    },
    /**
     * 获取附件列表
     * @param {*} params 
     * @returns 
     */
    getPageList(params = {}) {
        return request.request({
            url: 'system/attach/index',
            method: 'get',
            params
        })
    },
    /**
     * 移动分类，修改附件分类表单
     * @param {*} params 
     * @returns 
     */
    move(params = {}) {
        return request.request({
            url: 'system/attach/do_move',
            method: 'put',
            params
        })
    },
    /**
     * 修改附件名称
     * @param {*} params 
     * @returns 
     */
    updateFile(id, data = {}) {
        return request.request({
            url: 'system/attach/update/' + id,
            method: 'put',
            data
        })
    },

    /**
     * 删除文件
     * @param {*} data 
     * @returns 
     */
    deleteFile(data) {
        return request.request({
            url: 'system/attach/delete',
            method: 'delete',
            data
        })
    },
}